﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Controller
{
    public static class ExtendMethod
    {
        public static short GetCarrierAddr(this int stn)
        {
            if (stn % 10 == 1)
            {
                int n = stn / 10;
                return (short)(((n - 1) * 40) + 1);
            }
            else if (stn % 10 == 2)
            {
                int n = stn / 10;
                return (short)(((n * 40) - 20) + 1);
            }
            return 0;
            //return no = (stn - 800) / 10 + 60;
        }
        
        public static int GetXiangDaoStnNo(this int stn)
        {
            if (stn == ConstStn.Crane1Out1Stn)
            {
                return ConstStn.stn2;
            }
            else if (stn == ConstStn.Crane1Out2Stn)
            {
                return ConstStn.stn4;
            }
            else
            {
                return stn;
            }
        }
        public static int GetXiangDaoNo(this int stn)
        {
            if (stn / 10 == 4 || stn / 10 == 2)
            {
                return 1;
            }
            if (stn / 10 == 3 || stn / 10 == 1)
            {
                return 2;
            }
            return 0;
        }
    }
}
